<cfcomponent displayname="Parent for all Generator classes.">

	<cfscript>
		this.WorkLog= structNew();
		
		variables.CurrentContext = reReplace(ExpandPath('.'),'(#application.env.context#[\\\.a-zA-Z0-9/_-]+)$','#application.env.context#', 'ALL');
		variables.CurrentDateTime = TimeFormat(now(), "HH-mm-ss") & "-" & DateFormat(now(), "yyyy-mm-dd");
		
		variables.ContextName = "";
		variables.ContextPath = "";
		variables.ServerPort = cgi.server_port;
		variables.RelativePath = "";
		
		variables.BasePath = "";
		
		// convenience paths
		variables.ModelPath = "";
		variables.ViewPath = "";
		variables.ControllerPath = "";
		variables.DAOPath = "";
		variables.ResourcePath = "";
		variables.MigrationsPath = "";
		variables.ServicePath = "";
		
		// other 
		variables.jsPath = "";
		variables.cssPath = "";
		variables.imagesPath = "";
	</cfscript>	
	
	<cffunction name="init">
		<cfreturn this />
	</cffunction>
	
	<cffunction access="public" returntype="void" name="setTurbineProperties">
		<cfargument name="new_context_name" required="true" type="String" />
		<cfscript>
			variables.ContextName = arguments.new_context_name;
			variables.ContextPath = reReplaceNoCase(variables.CurrentContext,'#application.env.context#',variables.ContextName);
			
			variables.RelativePath = rereplacenocase(variables.ContextPath, '(#application.env.context#[a-zA-Z0-9\\/\.\_\-]*)$', variables.ContextName,'ALL');
		
			variables.BasePath = variables.ContextPath & "/app";

			// convenience paths
			variables.ModelPath = variables.BasePath & "/model";
			variables.ViewPath = variables.BasePath & "/view";
			variables.ControllerPath =  variables.BasePath & "/controller";
			variables.DAOPath =  variables.BasePath & "/dao";
			variables.ResourcesPath =  variables.BasePath;
			variables.MigrationsPath =  variables.BasePath & "/migrations";
			variables.ServicePath =  variables.BasePath & "/service-interface";
			
			variables.clientSideStuffDir = variables.ContextPath & "/public";
			// other 
			variables.jsPath = "#variables.clientSideStuffDir#/js";
			variables.cssPath = "#variables.clientSideStuffDir#/css";
			variables.imagesPath = "#variables.clientSideStuffDir#/images";
		</cfscript>
	</cffunction>
	
	
	<cffunction access="public" returntype="String" name="getTurbineProperty">
		<cfargument name="property_name" required="true" type="String" />	
		<cfloop collection="#variables#" item="i">
			<cfif i eq arguments.property_name>
				<cfreturn variables[i] />
			</cfif>
		</cfloop>
	</cffunction>
	<!--- documentation method --->
	<cffunction access="public" returntype="String" name="getAvailableProperties">
		<cfset var list_properties = "" />
		<cfloop collection="#variables#" item="i">
			<cfset list_properties = listAppend(list_properties,i) />
		</cfloop>
		<cfreturn list_properties />
	</cffunction>
	
	
	<cffunction name="WriteLog">
		<cfargument name="log_name" required="true" type="string" />
		<cfargument name="message" required="true" type="string" />
		
		<cfset this.WorkLog[arguments.log_name] = "#arguments.message#" />
	</cffunction>

</cfcomponent>